import request from "@/utils/request";
import { download } from "@/utils/request";

// 查询应用列表
export function getListById(params) {
  return request({
    url: "/equipFaultMode/equipFaultMode/list/",
    method: "get",
    params,
  });
}

// 下载模板
export function importTemplate() {
  return download("/equipFaultMode/equipFaultMode/importTemplate", {}, '设备故障模式导入模板.xlsx');
}


// 导入
export function importData(data) {
  return request({
    url: "/equipFaultMode/equipFaultMode/importData",
    method: "post",
    data,
  });
}
// XML文件导入1
export function importUpload(data) {
  return request({
    url: "/common/upload",
    method: "post",
    data,
  });
}
// XML导入接口2，传第一个接口的url和页面输入框
export function saveDeviceInfoFromXml(params) {
  return request({
    url: "/device/saveDeviceInfoFromXml",
    method: "get",
    params,
  });
}
// 编辑表格
export function editEquipFaultMode(data) {
  return request({
    url: "/equipFaultMode/equipFaultMode",
    method: "put",
    data,
  });
}

// 请求设备的诊断点名列表

export function getPointListByDeviceCode(params) {
  return request({
    url: "/point/getPointListByDeviceCode",
    method: "get",
    params,
  });
}

// 删除接口
export function deleteData(id) {
  return request({
    url: "/equipFaultMode/equipFaultMode/" + id,
    method: "delete",
  });
}

// 新增设备故障模式配置
export function addEquipFaultModeDevice(data) {
  return request({
    url: '/EquipFaultMode/EquipFaultModeDevice',
    method: 'post',
    data: data
  })
}

// 修改设备故障模式配置
export function updateEquipFaultModeDevice(data) {
  return request({
    url: '/EquipFaultMode/EquipFaultModeDevice',
    method: 'put',
    data: data
  })
}
// ----导入后保存-------------
export function addBatch(data) {
  return request({
    url: "/equipFaultMode/equipFaultMode/addBatch",
    method: "post",
    data,
  });
}
// ----加载编辑后批量保存-------------
export function editBatch(data) {
  return request({
    url: "/equipFaultMode/equipFaultMode/editBatch",
    method: "post",
    data,
  });
}
// ----加载编辑后单个保存-------------
export function editOneBatch(data) {
  return request({
    url: "/equipFaultMode/equipFaultMode",
    method: "put",
    data,
  });
}
// 删除
export function deleteBatch(params) {
  return request({
    url: "/equipFaultMode/equipFaultMode/" + params.ids,
    method: "delete",
  });
}
